<%@ attribute name="worker" required="true" type="by.epam.communalservices.entity.JkhWorker"%>
<%@ attribute name="dif"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags/connect" prefix="connect"%>
<%@ taglib tagdir="/WEB-INF/tags/worker" prefix="worker"%>
<%@ taglib tagdir="/WEB-INF/tags/table" prefix="table"%>


<connect:rule val="admin" rules="admin" />
<connect:rule val="editor" rules="admin,edit,worker_edit,kadrovik,brigadir" />
<connect:rule val="deletor" rules="admin,edit,worker_edit,kadrovik" />


<c:set var="link" value='"worker_edit?id=${worker.id}"' />
<c:set var="click" value=" onclick='document.location.href=${link}' style='cursor:hand;'"  />



<tr onmouseover="this.backup=this.style.backgroundColor;this.style.backgroundColor='red';"
	onmouseout="this.style.backgroundColor=this.backup;"  id="${dif}" >
	<td ${click}><c:out value="${worker.id}" /></td>
	<td ${click}><c:out value="${worker.surname}" /></td>
	<td ${click}><c:out value="${worker.name}" /></td>
	<td ${click}><c:out value="${worker.patronymic}" /></td>
	<td ${click}><c:out value="${worker.specialty}" /></td>
	<td ${click}>
		<table:select items="0,1,2,3,4,5,6,7,8,9" name="rate" attr="style='width:80px;'"
			selected="${worker.rate}" blocked="${true}" />
	</td>
	<td ${click}>
		<worker:team id="${worker.id}" />
	</td>
	<td id='l'>
		<connect:display rules="admin,view,team_view,kadrovik">
			<button type="button" onclick="document.location.href='worker_edit?id=${worker.id}'">edit</button>
			<button type="button" onclick="if (confirm('Уверены?')) document.location.href='worker_edit?delete=${worker.id}'" style="color:red;">delete</button>
		</connect:display>
		<connect:display rules="brigadir">
			<button type="button" onclick="document.location.href='worker_edit?id=${worker.id}'">view</button>
		</connect:display>
	</td>
</tr>